
$(function(){

    //  续费开通时间
    $('#renew-date').on('input propertychange', function() {
        checkRenewMoney();
    });


    $('#renew_type').bind('input change', function() {
        checkRenewMoney();
    });

    function checkRenewMoney(){
        var renew_date = parseInt($('#renew-date').val());
        var connect_num = parseInt($('#connect-num').val());
        var discount = $('#renew_type option:selected').val();

        if($('#renew-date').val() =="")
        {
            $('.renew_price').text('0.00');
            $('#data-price').val(0)

        } else{

            $('.renew_price').text((renew_date*connect_num*discount));
            $('#data-price').val((renew_date*connect_num*discount));
            $('#data-type').val($("#renew_type").find("option:selected").text());

        }

    }


    //    备注   字数限制
    $("#remark").keyup(function(){
        var len = $(this).val().length;
        if(len > 139){
            $(this).val($(this).val().substring(0,140));
        }
        var num = 140 - len + 1;
        $("#word").text(num);
    });




});